-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add force to umount to force the umount of a container image #198
Conversation
@nalind PTAL |
layers.go
Outdated
Unmount(id string) error | ||
Unmount(id string, force bool) (bool, error) | ||
|
||
// Mounted returns whether or not the layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a .
at the end of the godoc.
layers.go
Outdated
@@ -677,7 +691,7 @@ func (r *layerStore) Unmount(id string) error { | |||
layer.MountPoint = "" | |||
err = r.Save() | |||
} | |||
return err | |||
return false, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If err
is not nil
, this probably needs to be true
, since we're leaving the recorded MountCount
unchanged.
store.go
Outdated
@@ -262,8 +262,8 @@ type Store interface { | |||
Mount(id, mountLabel string) (string, error) | |||
|
|||
// Unmount attempts to unmount a layer, image, or container, given an ID, a | |||
// name, or a mount path. | |||
Unmount(id string) error | |||
// name, or a mount path. Returns whether or not the layer is still mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a .
at the end of the godoc.
The new value that |
Added test and handling of the umount return value. |
@nalind PTAL |
optionsHelp: "LayerOrContainerNameOrID", | ||
usage: "Check if a file system is mounted", | ||
minArgs: 1, | ||
action: mounted, | ||
addFlags: func(flags *mflag.FlagSet, cmd *command) { | ||
flags.BoolVar(&jsonOutput, []string{"-json", "j"}, jsonOutput, "Prefer JSON output") |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
layers.go
Outdated
@@ -677,7 +691,7 @@ func (r *layerStore) Unmount(id string) error { | |||
layer.MountPoint = "" | |||
err = r.Save() | |||
} | |||
return err | |||
return err != nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the Put()
succeeds but we fail to save the updated mount count, we return true
here. Is that the intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you tell me. The storage has unmounted the file system, but the database does not have the correct data. Does this mean it is mounted or not?
tests/mount-layer.bats
Outdated
run storage --debug=false mount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
# Check it layer is mounted | ||
run storage --debug=false mounted $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we compare to "$layer mounted"
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false unmount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false mount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false mounted $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Unmount the third layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false unmount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" == "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false unmount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed
tests/mount-layer.bats
Outdated
[ "$output" == "" ] | ||
|
||
|
||
# Mount the layer twice and force umount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a period at the end.
tests/mount-layer.bats
Outdated
run storage --debug=false mount $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false mounted $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Unmount the third layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
run storage --debug=false unmount --force $layer | ||
[ "$status" -eq 0 ] | ||
[ "$output" != "" ] | ||
# Check it layer is mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it/if, add a period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/mount-layer.bats
Outdated
[ "$status" -eq 0 ] | ||
[ "$output" == "" ] | ||
|
||
# Try to delete the first layer, which should fail because it has children. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't agree with the lines below it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
This includes changes to |
abe6f92
to
46f031b
Compare
WooHoo tests pass. |
6515e04
to
bbecea7
Compare
cmd/containers-storage/mount.go
Outdated
errText := "" | ||
if err != nil { | ||
errText = fmt.Sprintf("%v", err) | ||
errors = true | ||
} | ||
if !mounted { | ||
fmt.Printf("%s mountpoint unmounted\n", arg) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocker: in principle it seems... off to treat mounted
as useful if err
is set.
cmd/containers-storage/mount.go
Outdated
} | ||
if mounted { | ||
fmt.Printf("%s mounted\n", arg) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocker: in principle it seems... off to treat mounted
as useful if err
is set.
A couple of nits about the CLI's interpretation of results from |
Add force to umount to force the umount of a container image Add an interface to indicate whether or not the layer is mounted Add a boolean return from unmount to indicate when the layer is really unmounted Signed-off-by: Daniel J Walsh <[email protected]>
This check has been wrongly removed with containers#198 The check must stay as it's now part of the Stop/Delete API so reintroduce it back This fixes containers#233 and the associated CRI-O issues This PR + cri-o/cri-o#1910 fully fix the issue I'm going to revendor c/storage in CRI-O to full fix crio after this is merged Signed-off-by: Antonio Murdaca <[email protected]>
Signed-off-by: Daniel J Walsh [email protected]